<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">
<ui:composition template="../../templates/layout.xhtml">
    <ui:param name="jsfBean" value="#{fnConfiguracionJsfBean}"/>
    <ui:define name="title">Envios de Nota de Tarja</ui:define>
    <ui:define name="content">
        <p:spacer height="5px"/>
        <p:panel styleClass="pnlTitlePage">
            <h:outputText value="Configuración de Parametros" style="font-size:16px;" styleClass="resultHeader"/>
        </p:panel>
        <p:spacer height="5px"/>
        <h:form id="formPrincipal" prependId="false">
            <!-- Panel de búsqueda y resultados -->
            <p:panel id="pnlResultEnviosSeida" toggleable="false" toggleSpeed="250"
                     styleClass="pnlResult">
                <f:facet name="header">
                    <h:outputText value="Listado de Parametros"/>
                    <h:outputText value=" (Registros : #{jsfBean.resultListSize}) " styleClass="resultHeader"/>
                </f:facet>
                <p:dataTable id="dttResultadoEnviosSeida" value="#{jsfBean.resultList}"
                             var="item"
                             rowKey="#{item.parameterCode}"
                             emptyMessage="#{messages.label_no_records_found1}"
                             selection="#{jsfBean.selectedRows}"
                             resizableColumns="false"
                             paginator="#{jsfBean.showablePaginator}"
                             paginatorPosition="bottom"
                             paginatorTemplate="#{messages.label_dataTable_rows_per_page} {RowsPerPageDropdown} | {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} | #{messages.label_dataTable_jump_to_Page} {JumpToPageDropdown}"
                             rowsPerPageTemplate="#{jsfBean.initRowsPerResultPage},10,25,50"
                             rows="#{jsfBean.initRowsPerResultPage}"
                             style="width:100%">
                    <p:column styleClass="columnLeftTopClass"
                              style="min-width:100px; max-width:200px">
                        <f:facet name="header">
                            <h:outputText value="Nombre"/>
                        </f:facet>
                        <h:outputText value="#{item.parameterName}" />
                    </p:column>
                    <p:column styleClass="columnLeftTopClass" style="max-width:200px;">
                        <f:facet name="header">
                            <h:outputText value="Valor"/>
                        </f:facet>
                        <h:outputText value="#{item.parameterValue}"/>
                    </p:column>

                    <p:column styleClass="columnLeftTopClass" style="min-width:100px; max-width:200px">
                        <f:facet name="header">
                            <h:outputText value="Usuario"/>
                        </f:facet>
                        <h:outputText value="#{item.modificadoPor}"/>
                    </p:column>

                    <p:column styleClass="columnRighTopClass" style="min-width:100px; max-width:200px">
                        <f:facet name="header">
                            <h:outputText value="Fecha Modificación"/>
                        </f:facet>
                        <h:outputText value="#{item.fechaModificacion}">
                            <f:convertDateTime pattern="dd/MM/yyyy HH:mm:ss" timeZone="America/Lima" type="both"/>
                        </h:outputText>
                    </p:column>
                    <p:column styleClass="columnCenterTopClass" style="min-width:50px; max-width:200px">
                        <f:facet name="header">
                            <h:outputText value="Editar"/>
                        </f:facet>
                        <p:commandButton icon="ui-icon-zoomin" title="View"
                                         actionListener="#{jsfBean.showDialogAction}">
                            <f:attribute name="dlgWv" value="wvEditParametro"/>
                            <f:attribute name="selectedRow" value="#{item}"/>
                            <f:attribute name="accion" value="showEditar"/>
                        </p:commandButton>
                    </p:column>
                </p:dataTable>
            </p:panel>
        </h:form>
        <p:dialog id="dlgEditParametro"
                  header="Editar Valor"
                  modal="true" widgetVar="wvEditParametro" resizable="true"
                  dynamic="true" width="600">
            <p:outputPanel id="pnlEditParametro">
                <h:form>
                    <h:panelGrid columns="1" styleClass="centered">
                        <h:outputLabel for="txtNombre" value="Nombre"/>
                        <p:inputText id="txtNombre" value="#{jsfBean.parametroVm.parameterName}"
                                     size="20" maxlength="50" disabled="true"/>

                        <h:outputLabel for="txtValor" value="Valor"/>
                        <p:inputText id="txtValor" value="#{jsfBean.parametroVm.parameterValue}"
                                     size="60" maxlength="150"/>
                    </h:panelGrid>
                    <h:panelGrid columns="2" styleClass="centered">
                        <p:commandButton value="#{messages.label_aceptar}"
                                         actionListener="#{jsfBean.saveAction}">
                            <f:attribute name="dlgWv" value="wvEditParametro"/>
                        </p:commandButton>
                        <p:commandButton value="#{messages.label_close}"
                                         onclick="wvEditParametro.hide()"/>
                    </h:panelGrid>
                </h:form>
            </p:outputPanel>
        </p:dialog>
        <p:dialog id="dlgEditParametroComplex"
                  header="Editar Valor"
                  modal="true" widgetVar="wvEditParametroComplex" resizable="true"
                  dynamic="true" width="600">
            <p:outputPanel id="pnlEditParametroComplex">
                <h:form>

                    <p:pickList id="pojoPickList" value="#{jsfBean.depositos}" var="item"
                                itemValue="#{item}" itemLabel="#{item}"
                                showSourceControls="true" showTargetControls="true" showCheckbox="true"
                                showSourceFilter="true" showTargetFilter="true" filterMatchMode="contains" >

                        <f:facet name="sourceCaption">Disponible</f:facet>
                        <f:facet name="targetCaption">Seleccionados</f:facet>

                        <p:column style="width:75%;">
                            #{item}
                        </p:column>

                    </p:pickList>

                    <h:panelGrid columns="2" styleClass="centered">
                        <p:commandButton value="#{messages.label_aceptar}"
                                         actionListener="#{jsfBean.saveAction}">
                            <f:attribute name="dlgWv" value="wvEditParametroComplex"/>
                        </p:commandButton>
                        <p:commandButton value="#{messages.label_close}"
                                         onclick="wvEditParametroComplex.hide()"/>
                    </h:panelGrid>
                </h:form>
            </p:outputPanel>
        </p:dialog>
    </ui:define>
</ui:composition>
</html>